package com.qqtech.qquan.community.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.qquan.community.model.CommunityMessage;
import com.qqtech.qquan.community.model.CommunityMessageQuery;
import com.qqtech.qquan.community.model.CommunityMessageVo;

import java.util.List;

public interface CommunityMessageDao extends BaseDao<CommunityMessage> {
	/**
	 * 邻里动态好友优先显示数量
	 * @param query
	 * @return
	 */
	public int queryCountFriendUp(CommunityMessageQuery query);
	
	/**
	 * 后台查询 -分页
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<CommunityMessageVo> queryPageListAdmin(CommunityMessageQuery query, Pageable pageable);

	/**
	 * 后台查询记录数
	 * @param query
	 * @return
	 */
	public int queryCountAdmin(CommunityMessageQuery query);
	/**
	 * 邻里动态好友优先显示
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<CommunityMessageVo> queryPageFriendUp(CommunityMessageQuery query, Pageable pageable);
	/**
	 * 增加点击量
	 * 
	 * @param id
	 * @return
	 */
	int updatePv(Integer id);
	
	/**
	 * 增加（减少）评论数
	 * @param id
	 * @param addCount
	 * @return
	 */
	int increaseComment(Integer id, int addCount);
	
	/**
	 * 增加（减少）点赞数
	 * @param id
	 * @param addCount
	 * @return
	 */
	int increasePraise(Integer id, int addCount);

	CommunityMessageVo queryTotalCountByCreatorId(CommunityMessageQuery query);

	List<CommunityMessageVo> queryTotalCountByCreatorIds(CommunityMessageQuery query);
}
